package oop.day07.homework;
// 播放器管理类
public class MediaPlayer {
    Playable[] playables;
    MediaPlayer(){
        playables = new Playable[10];
    }
    public void addPlayer(int index, Playable playable){
        if (index>=0 && index<playables.length){
            playables[index] = playable;
        }else {
            System.out.println("播放列表位置错误，输入0-9的位置。");
        }

    }
    public void playAll(){
        for(Playable playable : playables){
           if(playable != null){
               playable.play();
               playable.pause();
               playable.stop();
           }

        }
    }
}
